package com.longchat.repository;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import com.longchat.domain.award.VoteLog;

public interface VoteLogJpaRepository extends CrudRepository<VoteLog, Integer> {

	@Query("from VoteLog v where v.openid=?1 AND v.questionnarire.id=?2")
	VoteLog findByOpenid(String openid,Integer questionnaireid);
	
	@Query("from VoteLog v JOIN v.options o where v.openid=?1 AND v.questionnarire.id=?2 AND o.id=?3")
	VoteLog findCheckByOpenid(String openid,Integer questionnaireid,Integer optionid);
}
